package com.zhonghui.modlules.cart.eshopMapper;

import com.zhonghui.common.eshopMapper.CoreMapper;
import com.zhonghui.modlules.cart.eshopDomain.StoreCart;
import com.zhonghui.modlules.order.eshopDto.CountDto;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import java.util.List;

@Repository
public interface StoreCartMapper extends CoreMapper<StoreCart> {
@Select({"select IFNULL(sum(cart_num),0) from store_cart where is_pay=0 and is_del=0 and is_new=0 and uid=#{uid}"})
    int cartSum(@Param("uid") Long uid);

@Select({"SELECT t.cate_name as catename from store_cart c  LEFT JOIN store_product p on c.product_id = p.id  LEFT JOIN store_category t on p.cate_id = t.id WHERE c.is_pay = 1"})
    List<CountDto> findCateName();
        }

